#include<iostream>
using namespace std;

typedef int ElemType ;

typedef struct StackNode
{
	ElemType data;
	struct StackNode *next;
}tStackNode;

tStackNode *top;
static int count;

void createStack()
{
	top = new StackNode();
	count = 0;
	top->next = NULL;
}

void Push(ElemType e)
{
	tStackNode *s = new tStackNode();
	s->data = e;
	s->next = top;
	top = s;
	count++;
	cout<<"count = "<<count<<endl;
}

void Pop()
{
	tStackNode *p = top;
	top = p->next;
	count--;
	cout<<"count = "<<count<<endl;
	delete p;	
}


int main()
{
	int a[]={10,9,8,7,6,5,4,3,2,1};
	createStack();
	int len = sizeof(a)/sizeof(a[0]);

	for(int i=0;i<len;i++)
		Push(a[i]);

	for(int i=0;i<len;i++)
		Pop();

	return 0;
}




